<?php

namespace CHOMP\SGIBundle\Services\Mailer;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityRepository;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\HttpKernel;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;

class Mailer
{
	protected $name;
	protected $em;

	public function __construct(){    
		$this->name = '';
		//$this->em = $em;
    }

	public function decirHola(){
		$this-> name = 'hola';
		return $this->name;
	}

	public function sendEmail($anAddress){
		return 'Will send an email to this address: '.$anAddress;
	}

	public function addDefaultRoles(GetResponseForExceptionEvent $event){
        // You get the exception object from the received event
        $exception = $event->getException();
       
	}

	/*
		buscar si sirve algo así para ajax
	*/
	public function onKernelRequest(GetResponseEvent $event)
    {
        if (HttpKernel::MASTER_REQUEST != $event->getRequestType()) {
            // don't do anything if it's not the master request
            return;
        }

        // ...
    }
}

?>